<%--
  Created by IntelliJ IDEA.
  User: ZhuChunXiao
  Date: 2017/5/26
  Time: 15:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<%--<div id="page-content">--%>
  <%--<div class="row">--%>

    <%--<div class="col-lg-12">--%>
      <%--<div class="panel">--%>
        <%--<div class="panel-heading">--%>
          <%--<h3 class="panel-title">已领用</h3>--%>
        <%--</div>--%>
        <div class="panel-body">
          <input type="hidden" id="parentId" value="${parentId}" />
          <div class="table-responsive" id="assetuse_in_list_row">
            <table id="assetuse_in_table"></table>
            <div id="assetuse_in_page"></div>
          </div>
        </div>
        <div class="panel-footer">
          <a class="btn btn-default" id="apply-re-common5" href="javascript:void(0)">
            <i class="fa fa-lg fa-mail-reply"></i> 返回视图
          </a>
        </div>
      <%--</div>--%>
    <%--</div>--%>

  <%--</div>--%>
<%--</div>--%>

<script>

  $(function(){

    init_grid_assetuse();
    jQuery("#assetuse_in_table").jqGrid('setGridWidth',  $('div').data("table_global_width")-66);

  });

  function init_grid_assetuse() {

    __init_jqgrid('assetuse_in_table', 'assetuse_in_page',
            '<%=path%>/com/assetUse/list',
            ['资产编号','资产名称','品牌','规格型号','采购金额（元）','使用人','文档状态', '操作', 'id'],
            [
              {name: 'assetNo', index: 'assetNo', width: 80, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'name', index: 'name', width: 80, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'brand', index: 'brand', width: 80, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'model', index: 'model', width: 40, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'purchaseMoney', index: 'purchaseMoney', width: 40, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'user', index: 'user', width: 40, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'txtStatus', index: 'txtStatus', width: 40, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'act', index: 'act', width: 200, fixed: true, sortable: false, search: false, formatter: actFormat},
              {name: 'id', index: 'id', width: 100, key: true, hidden: true, hidedlg: true}
            ],
            true,
            {
              postData: {catalog: 0x03,parentId: $("#parentId").val()}
            }
    );

  }

  function actFormat(cellvalue, options, rowObject){
    var id = rowObject.id;
    cellvalue = '<button class="btn btn-white btn-sm" onclick="fn_assetuse_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';
    return cellvalue;
  }

  function fn_assetuse_read(id) {
    loadURL('<%=path%>/com/assetUse/read?keyId='+id, $('#s5'));
  }

  //返回视图
  $("#apply-re-common5").click(returnToHashUrl);

</script>